package com.szrt.day20170424;


import java.io.File;
import java.io.FileReader;
import java.io.Reader;

import org.junit.Test;


/**
 * 字符输入流  FileReader
 * @author scott-13926583118
 * 2017年4月24日
 *
 */
public class ReaderTest {
	
	@Test
	public void testName() throws Exception {
		
		//1 
		File file = new File("io1704/xsy.txt");
		Reader reader  = new FileReader(file);
		
		char[] cbuf = new char[3];
		
		
		int len = -1;
		
		while((len = reader.read(cbuf))!=-1){
			//如何把char数组转化为字符串
			String string  = new String(cbuf,0,len);
			System.out.print(string);
			
		}
		
		reader.close();
		
		
	}

}
